package hczc.longcai.com.hccrowdfunding.home.first_index.activities;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.activity.BaseActivity;
import hczc.longcai.com.hccrowdfunding.home.first_index.adapters.IndexHotAdapter;
import hczc.longcai.com.hccrowdfunding.home.first_index.beans.ProjectInfo;
import hczc.longcai.com.hccrowdfunding.search.SearchActivity;
import hczc.longcai.com.hccrowdfunding.utils.bitmaputils.ImageLoader;

public class ShowProjectActivity extends BaseActivity implements View.OnClickListener {

    private static final String TAG = "ShowProjectActivity";
    private ImageView back;
    private TextView title;
    private ImageView serach;
    private Bundle extras;
    private String title1;
    private ListView listView;

    private List<ProjectInfo> list;
    private IndexHotAdapter adapter;
    private ImageLoader imageLoader;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_flash_time);

        imageLoader = new ImageLoader(this);

        initListView();
        initDatas();
        initViews();
    }

    private void initListView() {
        listView = ((ListView) findViewById(R.id.index_show_project_listview));
        list = new ArrayList<>();

        adapter = new IndexHotAdapter(this, list,imageLoader);
        listView.setAdapter(adapter);

    }

    private void initDatas() {
        Intent intent = getIntent();
        extras = intent.getExtras();
        title1 = extras.getString("title");
        switch (title1) {
            case "限时抢购":

                break;
            case "最新上线":

                break;

            case "综合推荐":

                break;


        }
    }

    private void initViews() {
        findViewById(R.id.head_back).setOnClickListener(this);
        title = ((TextView) findViewById(R.id.head_title));
        title.setText(title1);
        serach = ((ImageView) findViewById(R.id.head_right_pic));
        serach.setVisibility(View.VISIBLE);
        serach.setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        int index = view.getId();
        switch (index) {
            case R.id.head_back:
                finish();
                break;
            case R.id.head_right_pic:
                startActivity(new Intent(ShowProjectActivity.this, SearchActivity.class));
                break;
        }
    }
}
